package model;

import lombok.Data;

import java.io.Serializable;

@Data
public class MyCourseTime implements Serializable {
	int classWeek;
    String classWeekTxt;
	int classBegin;
	int classEnd;
	
	public MyCourseTime() {
		super();
	}

	public MyCourseTime(int cW, int cB, int cE) {
		super();
		this.classWeek = cW;
		this.classBegin = cB;
		this.classEnd = cE;
	}
	public MyCourseTime(String cW, int cB, int cE) {
		super();
		this.classWeekTxt = cW;
		this.classBegin = cB;
		this.classEnd = cE;
		switch(classWeekTxt)
		{case "Mon":classWeek=1;break;
		case "Tues":classWeek=2;break;
		case "Wed":classWeek=3;break;
		case "Thurs":classWeek=4;break;
		case "Fri":classWeek=5;break;
		case "Sat":classWeek=6;break;
		case "Sun":classWeek=7;break;
		case "周一":classWeek=1;break;
		case "周二":classWeek=2;break;
		case "周三":classWeek=3;break;
		case "周四":classWeek=4;break;
		case "周五":classWeek=5;break;
		case "周六":classWeek=6;break;
		case "周日":classWeek=7;break;
		}
	}
	public String toEnglish(String cW) {
		switch(cW)
		{
			case "周一":cW="1";break;
			case "周二":cW="2";break;
			case "周三":cW="3";break;
			case "周四":cW="4";break;
			case "周五":cW="5";break;
			case "周六":cW="6";break;
			case "周日":cW="7";break;
			case "周天":cW="7";break;
			case "星期一":cW="1";break;
			case "星期二":cW="2";break;
			case "星期三":cW="3";break;
			case "星期四":cW="4";break;
			case "星期五":cW="5";break;
			case "星期六":cW="6";break;
			case "星期日":cW="7";break;
			case "星期天":cW="7";break;
		}
		return cW;
	}
	public String toChinese(int w)
	{
		String str = null;
		switch(classWeek)
		{
			case 1:str="周一"; break;
			case 2:str="周二";break;
			case 3:str="周三";break;
			case 4:str="周四";break;
			case 5:str="周五";break;
			case 6:str="周六";break;
			case 7:str="周天";break;
		}
		return str;
	}
	@Override
    public String toString() {
        return
                toChinese(classWeek) + " "+ classBegin +"~"+classEnd+"节课"
                ;
    }
}


